<div id='checkoutFormDIV'> 

<style>
<!--
.divcart_button{
	float:right;
}
.item_description{
	
}

-->
</style>

<?=form_open($this->public_model->getBaseSSLUrl() . 'shoppingcart/checkout','name="checkoutForm"');?>


<div id="cart_items_container" class="module-body">
	<div id="cart_items">
		<header>
			<h2 id="totalItems">
				You have <span class="amount">1</span> item in your cart!
			</h2>
			<div class="divcart_button">
				<a class="button" href="/goods" title="Continue Shopping">Continue Shopping</a> 
				<a class="button" href="/cart/checkout" title="Proceed to Checkout">Proceed to Checkout</a>
			</div>
		</header>
		<br><br>
		<table>
			<thead>
				<tr>
					<th class="item_description" style="width:475px;text-align:left" colspan="2">Item Description</th>
					<th class="price" style="width:90px;text-align:left">Point</th>
					<th class="price" style="width:70px;text-align:left">Fee</th>
					<th class="x">&nbsp;</th>
					<th class="quantity" style="width:100px;text-align:left">Quantity</th>
					<th class="subtotal" style="width:100px;text-align:left">Subtotal</th>
				</tr>
			</thead>
			<tbody id="items">
				<?php $i = 1; 
					  $subtotal_point = 0;
					  $subtotal_fee = 0;		
				?>
				<?php foreach ($this->cart->contents() as $item):?>				
						<tr class="item">
							<td style="width:102px">
								<img src="https://img.grouponcdn.com/deal/quwegua6BfDoQXdfqfk2/Lo-960x582/v1/t100x100.jpg" alt="12-Ft. Dryer Vent Cleaner Kit">
							</td>
							<td class="title" style="text-align:left">
								<a href="/product/detail/<?=$item['id']?>"><?=$item['name']?></a>
							</td>
							<td><?=$item['point'] . ' P'?></td>
							<td><?='$' . $item['processing_fee']?></td>
							<td>x</td>
							<td><input type="text" size="2" value="<?=$item['qty']?>"/></td>
							<td><?=round($item['point'] * $item['qty'], 2) . ' P + $' . $item['processing_fee']?></td>

						</tr>
				<?php $i++; 
					$subtotal_point += $item['point'] * $item['qty'];
					$subtotal_fee += $item['processing_fee'] * $item['qty'];
				?>
				<?php endforeach; ?>
			</tbody>
			<tfoot>
				<tr id="subtotal">
					<td class="label" colspan="6">Subtotal:</td>
					<td class="subtotal"><?=$subtotal_point . ' P + $' . $subtotal_fee?></td>
				</tr>
			</tfoot>
		</table>
		
		
		<div>
		
			<table>
				
				<tr>
					<td class = "subheading" colspan="2">
								<?php echo validation_errors('<div class="errorText">', '</div>'); ?>
					</td>
				</tr>
				<tr>
					<td class="errorText" align="left" colspan="2"><div id="errorDiv" class="errorText"></div></td>
				</tr>
				<tr>
					<td class="resultText" align="left" colspan="2"><div id="resultDiv"></div></td>
				</tr>
		
		<tr>
   		 	<td class="notReq">Choose Card Type:</td>
   		 	<td><?php echo  form_dropdown('paymentCardType', $cardtypelist,set_value('paymentCardType',isset($cardtype)?$cardtype:null),'id="paymentCardType"'); ?>
	   		 					<span class="req"><img class='creditCardImage' src='/images/cards.jpg' alt='cards'/></span></td>
   		 </tr>
   		  <tr>
   		 	<td class="notReq">Card Holder Name:</td>
   		 	<td><?php echo form_input('paymentName', set_value('paymentName',isset($paymentName)?$paymentName:null),'size="20" id="paymentName" maxlength="255"'); ?></td>
   		 </tr>
   		 <tr>
   		 	<td class="notReq">Card Number:</td>
   		 	<td><?php echo form_input('paymentNumber', set_value('paymentNumber',null),'size="20" id="paymentNumber" maxlength="16" onkeypress="return validateKeyPressIsNumber(event);"'); ?></td>
   		 </tr>
   
   		 <tr>
   		 	<td class="notReq">CVV Code:</td>
   		 	<td><?php echo form_password('paymentCVV2Code', set_value('paymentCVV2Code',isset($paymentCVV2Code)?$paymentCVV2Code:null),'size="20" id="paymentCVV2Code" maxlength="4" onkeypress="return validateKeyPressIsNumber(event);"'); ?></td>
   		 </tr>
   		 <tr>
   		 	<td class="notReq">Exp. Date</td>
   			<td>
   		 		<?php echo  form_dropdown('paymentExpireMonth', $monthlist,set_value('paymentExpireMonth',isset($paymentExpireMonth)?$paymentExpireMonth:$currentmonth),'id="paymentExpireMonth"'); ?>
				<?php echo  form_dropdown('paymentExpireYear', $yearlist,set_value('paymentExpireYear',isset($paymentExpireYear)?$paymentExpireYear:$currentyear),'id="paymentExpireYear"'); ?>
   		 	</td>
   		 </tr>		
		<tr>
			<td colspan="2">				
			<table class="pageContent" style="width:90%">
			<tbody>
							
			<tr>
				<td class="notReq"><span id = "spanAddress1" class="colortext" style = "display:none">*</span>Address 1:</td>
				<td><?php echo form_input('biAddress1', set_value('biAddress1'),'size="30" maxlength="255" ');  
            		?>                		 
            	</td>
			</tr>
			<tr>
				<td class="notReq">Address 2:</td>
				<td><?php echo form_input('biAddress2', set_value('biAddress2'),'size="30" maxlength="255" '); ?></td>
			</tr>
			<tr>
				<td class="notReq">Country:</td>
				<td><?php echo  form_dropdown('biCountry', $countryList,$currentBiCountryCode); ?><input type="hidden" id="hasbiState" name="hasbiState" value="" /></td>
			</tr>	
			<tr>
				<td class="notReq"><span id = "spanCity" class="colortext" style = "display:none">*</span>City:</td>
				<td><?php echo form_input('biCity', set_value('biCity'),'size="30" maxlength="255" '); ?></td>
			</tr>
			<tr>
				<td class="notReq">State/Province:</td>
				<td><?php echo form_dropdown('biState', $usStateList,''); ?>
					<?php echo form_input('biStateText', set_value('biStateText'),'id="biStateTextId" maxlength="255" style="display:none"'); ?>
				</td>
			</tr>	
			<tr>
				<td class="notReq"><span id = "spanZip" class="colortext" style = "display:none">*</span>Zip:</td>
				<td><?php echo form_input('biZip', set_value('biZip'),'size="9" maxlength="9" '); ?></td>
			</tr>	
			<tr>
				<td class="notReq"><span id = "spanPhone" class="colortext" style = "display:none">*</span>Phone:</td>
				<td>(<?php echo form_input('biPhone1', set_value('biPhone1'),'size="3"  maxlength="3" onkeypress="return validateKeyPressIsNumber(event);"'); ?>)<?php echo form_input('biPhone2', set_value('biPhone2'),'size="8"  maxlength="8" onkeypress="return validateKeyPressIsPhone(event);"'); ?> &nbsp;Ext<?php echo form_input('biPhone3', set_value('biPhone3'),'size="5"  maxlength="5" onkeypress="return validateKeyPressIsNumber(event);"'); ?></td>
			</tr>					
			<tr>
				<td colspan="2" class="spacer">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<a class="button" href="javascript:doCheckout()" onclick="">Complete Order</a>
				</td>
			</tr>
			</table>	
		</div>
	</div>
</div>

<?=form_close();?>

<script>
<!-- 
	 var options = {   
            success: doCheckoutResponse  // post-submit callback 
    }; 
     
    // bind to the form's submit event 
    $('[name=checkoutForm]').submit(function() { 
        $(this).ajaxSubmit(options);      
        return false; 
    });
-->    
</script>

</div>